package com.tyt.lelan.provider;

import android.net.Uri;
import android.provider.BaseColumns;

public class FeedsData {
	
	public static final String CONTENT = "content://";
	public static final String AUTHORITY = "com.tyt.lelan";
	
	public static final String _ID="_id";
	public static final String NAME="name";
	
	private static final String TYPE_PRIMARY_KEY = "INTEGER PRIMARY KEY AUTOINCREMENT";
	private static final String TYPE_TEXT = "TEXT";
	private static final String TYPE_INT="INT";
	private static final String TYPE_BLOB="BLOB";
	
	/**
	 * 推荐分类
	 * @author yyj
	 *
	 */
	public static class CategoryColumns implements BaseColumns{
		
		public static final String TABLENAME="category";
		public static final String NUMBER="number";
	    
	    public static final String[] COLUMNS = new String[] {_ID,NAME, NUMBER};
		public static final String[] TYPES = new String[] {TYPE_PRIMARY_KEY,TYPE_TEXT,TYPE_INT };
		
		public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.tyt.lelan.category";
	    public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.tyt.lelan.category";
	    
	    public static final Uri CONTENT_URI=Uri.parse(new StringBuilder(CONTENT).append(AUTHORITY).append("/").append(TABLENAME).toString());
	    
	}

	/**
	 * 已经订阅
	 * @author yyj
	 *
	 */
	public static class MyFeedsColumns  implements BaseColumns{
		
		public static final String TABLENAME="myfeeds";
		
		public static final String CATEGORY="category";
		public static final String LINK="link";
		public static final String ICON_NAME="icon_name";
		public static final String RSS_ID="rss_id";
	  
	    public static final String[] COLUMNS = new String[] {_ID,CATEGORY, NAME,LINK,ICON_NAME,RSS_ID};
		public static final String[] TYPES = new String[] {TYPE_PRIMARY_KEY,TYPE_TEXT, TYPE_TEXT,TYPE_TEXT,TYPE_TEXT,TYPE_INT};
		
		
		public static final String CONTENT_TYPE_MYFEEDS = "vnd.android.cursor.dir/vnd.tyt.lelan.myfeeds";
	    public static final String CONTENT_ITEM_TYPE_MYFEEDS = "vnd.android.cursor.item/vnd.tyt.lelan.myfeeds";
		
		public static final Uri CONTENT_URI=Uri.parse(new StringBuilder(CONTENT).append(AUTHORITY).append("/").append(TABLENAME).toString());
	}
	
	/**
	 * 所有订阅资源
	 * @author yyj
	 *
	 */
	public static class AllFeedsColumns implements BaseColumns{
		
		public static final String TABLENAME="allfeeds";
		
		public static final String LINK="link";
		public static final String CATEGORY="category";
		public static final String ICON_NAME="icon_name";
		public static final String SELECTED="selected";
		
		public static final Uri CONTENT_URI=Uri.parse(new StringBuilder(CONTENT).append(AUTHORITY).append("/").append(TABLENAME).toString());
		public static final String CONTENT_TYPE_ALLFEEDS = "vnd.android.cursor.dir/vnd.tyt.lelan.allfeeds";
		public static final String CONTENT_ITEM_TYPE_ALLFEEDS = "vnd.android.cursor.item/vnd.tyt.lelan.allfeeds";
		 
		public static final String[] COLUMNS = new String[] {_ID,CATEGORY, NAME,LINK,ICON_NAME,SELECTED};
		public static final String[] TYPES_ALLFEEDS = new String[] {TYPE_PRIMARY_KEY,TYPE_TEXT, TYPE_TEXT,TYPE_TEXT,TYPE_TEXT,TYPE_INT+" DEFAULT (0)" };
				
	}
	
	/**
	 * 所有icon资源
	 * @author yyj
	 *
	 */
	
	public static class IconColumns implements BaseColumns{
		
		public static final String TABLENAME="icons";
		
		public static final String LINK="link";
		public static final String ICON="icon";
		
		public static final Uri CONTENT_URI=Uri.parse(new StringBuilder(CONTENT).append(AUTHORITY).append("/").append(TABLENAME).toString());
		public static final String CONTENT_TYPE_ICONS = "vnd.android.cursor.dir/vnd.tyt.lelan.icons";
		public static final String CONTENT_ITEM_TYPE_ICONS = "vnd.android.cursor.item/vnd.tyt.lelan.icons";
		 
		public static final String[] COLUMNS = new String[] {_ID, NAME,ICON};
		public static final String[] TYPES = new String[] {TYPE_PRIMARY_KEY,TYPE_TEXT, TYPE_BLOB };
		
		public static Uri CONTENT_URI(long id) {
			return Uri.parse(new StringBuilder(CONTENT).append(AUTHORITY).append("/").append(TABLENAME).append(id).toString());
		}
	}
	
	
	/**
	 * 所有rss内容
	 * @author tank
	 *
	 */
    public static class EntryColumns implements BaseColumns {
    	
		public static final String TABLENAME="entries";
		
		public static final String RSS_ID = "rss_id";
		
		public static final String TITLE = "title";
		
		public static final String DESCRIPTION = "description";
		
		public static final String PUBDATE = "pubDate";
		
		public static final String LINK = "link";
		
		public static final String READFLAG = "readflag";
		
		public static final String STARRED = "starred";
		
		public static final String[] COLUMNS = new String[] {_ID, RSS_ID, TITLE, DESCRIPTION, PUBDATE, LINK, READFLAG,STARRED};
		
		public static final String[] TYPES = new String[] {TYPE_PRIMARY_KEY, TYPE_INT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_TEXT, TYPE_INT+" DEFAULT (0)",TYPE_INT+" DEFAULT (0)"};

		public static final Uri CONTENT_URI=Uri.parse(new StringBuilder(CONTENT).append(AUTHORITY).append("/").append(TABLENAME).toString());
		
		public static Uri CONTENT_URI(long id) {
			return Uri.parse(new StringBuilder(CONTENT).append(AUTHORITY).append("/rss/").append(id).append("/entries").toString());
		}

		public static Uri CONTENT_ENTRY_URI(long entryId) {
			return Uri.parse(new StringBuilder(CONTENT).append(AUTHORITY).append("/entries/").append(entryId).toString());
		}
		
	}
	
}
